﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsModel : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsModel(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGsModel_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsModel obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsModel()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsModel(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGsModel cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGsModel_cast(OdRxObject.getCPtr(pObj));
			OdGsModel result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsModel_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsModel_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsModel_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGsModel createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGsModel_createObject();
			OdGsModel result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGsModel)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void onAdded(OdGiDrawable pAdded, OdGiDrawable pParent)
		{
			GlobalsPINVOKE.OdGsModel_onAdded__SWIG_0(this.swigCPtr, OdGiDrawable.getCPtr(pAdded), OdGiDrawable.getCPtr(pParent));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void onAdded(OdGiDrawable pAdded, OdDbStub parentID)
		{
			GlobalsPINVOKE.OdGsModel_onAdded__SWIG_1(this.swigCPtr, OdGiDrawable.getCPtr(pAdded), OdDbStub.getCPtr(parentID));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void onModified(OdGiDrawable pModified, OdGiDrawable pParent)
		{
			GlobalsPINVOKE.OdGsModel_onModified__SWIG_0(this.swigCPtr, OdGiDrawable.getCPtr(pModified), OdGiDrawable.getCPtr(pParent));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void onModified(OdGiDrawable pModified, OdDbStub parentID)
		{
			GlobalsPINVOKE.OdGsModel_onModified__SWIG_1(this.swigCPtr, OdGiDrawable.getCPtr(pModified), OdDbStub.getCPtr(parentID));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void onErased(OdGiDrawable pErased, OdGiDrawable pParent)
		{
			GlobalsPINVOKE.OdGsModel_onErased__SWIG_0(this.swigCPtr, OdGiDrawable.getCPtr(pErased), OdGiDrawable.getCPtr(pParent));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void onErased(OdGiDrawable pErased, OdDbStub parentID)
		{
			GlobalsPINVOKE.OdGsModel_onErased__SWIG_1(this.swigCPtr, OdGiDrawable.getCPtr(pErased), OdDbStub.getCPtr(parentID));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void invalidate(OdGsModel.InvalidationHint hint)
		{
			GlobalsPINVOKE.OdGsModel_invalidate__SWIG_0(this.swigCPtr, (int)hint);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void invalidate(OdGsView pView)
		{
			GlobalsPINVOKE.OdGsModel_invalidate__SWIG_1(this.swigCPtr, OdGsView.getCPtr(pView));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTransform(OdGeMatrix3d arg0)
		{
			GlobalsPINVOKE.OdGsModel_setTransform(this.swigCPtr, OdGeMatrix3d.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGeMatrix3d transform()
		{
			OdGeMatrix3d result = new OdGeMatrix3d(GlobalsPINVOKE.OdGsModel_transform(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void highlight(OdGiPathNode path, bool bDoIt, OdGsView pView)
		{
			GlobalsPINVOKE.OdGsModel_highlight__SWIG_0(this.swigCPtr, OdGiPathNode.getCPtr(path), bDoIt, OdGsView.getCPtr(pView));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void highlight(OdGiPathNode path, bool bDoIt)
		{
			GlobalsPINVOKE.OdGsModel_highlight__SWIG_1(this.swigCPtr, OdGiPathNode.getCPtr(path), bDoIt);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void highlight(OdGiPathNode path)
		{
			GlobalsPINVOKE.OdGsModel_highlight__SWIG_2(this.swigCPtr, OdGiPathNode.getCPtr(path));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setRenderType(OdGsModel.RenderType renderType)
		{
			GlobalsPINVOKE.OdGsModel_setRenderType(this.swigCPtr, (int)renderType);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGsModel.RenderType renderType()
		{
			OdGsModel.RenderType result = (OdGsModel.RenderType)GlobalsPINVOKE.OdGsModel_renderType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setRenderModeOverride(OdGsView.RenderMode mode)
		{
			GlobalsPINVOKE.OdGsModel_setRenderModeOverride__SWIG_0(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setRenderModeOverride()
		{
			GlobalsPINVOKE.OdGsModel_setRenderModeOverride__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setAdditionMode(OdGsModel.AdditionMode mode)
		{
			GlobalsPINVOKE.OdGsModel_setAdditionMode(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGsModel.AdditionMode additionMode()
		{
			OdGsModel.AdditionMode result = (OdGsModel.AdditionMode)GlobalsPINVOKE.OdGsModel_additionMode(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setBackground(OdDbStub backgroundId)
		{
			GlobalsPINVOKE.OdGsModel_setBackground(this.swigCPtr, OdDbStub.getCPtr(backgroundId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdDbStub background()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGsModel_background(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setVisualStyle(OdDbStub visualStyleId)
		{
			GlobalsPINVOKE.OdGsModel_setVisualStyle__SWIG_0(this.swigCPtr, OdDbStub.getCPtr(visualStyleId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdDbStub visualStyle()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGsModel_visualStyle__SWIG_0(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setVisualStyle(OdGiVisualStyle visualStyle)
		{
			GlobalsPINVOKE.OdGsModel_setVisualStyle__SWIG_1(this.swigCPtr, OdGiVisualStyle.getCPtr(visualStyle));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool visualStyle(OdGiVisualStyle visualStyle)
		{
			bool result = GlobalsPINVOKE.OdGsModel_visualStyle__SWIG_1(this.swigCPtr, OdGiVisualStyle.getCPtr(visualStyle));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void addModelReactor(OdGsModelReactor pReactor)
		{
			GlobalsPINVOKE.OdGsModel_addModelReactor(this.swigCPtr, OdGsModelReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeModelReactor(OdGsModelReactor pReactor)
		{
			GlobalsPINVOKE.OdGsModel_removeModelReactor(this.swigCPtr, OdGsModelReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setEnableSectioning(bool bEnable)
		{
			GlobalsPINVOKE.OdGsModel_setEnableSectioning(this.swigCPtr, bEnable);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool isSectioningEnabled()
		{
			bool result = GlobalsPINVOKE.OdGsModel_isSectioningEnabled(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool setSectioning(OdGePoint3dArray points, OdGeVector3d upVector)
		{
			bool result = GlobalsPINVOKE.OdGsModel_setSectioning__SWIG_0(this.swigCPtr, OdGePoint3dArray.getCPtr(points), OdGeVector3d.getCPtr(upVector));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool setSectioning(OdGePoint3dArray points, OdGeVector3d upVector, double dTop, double dBottom)
		{
			bool result = GlobalsPINVOKE.OdGsModel_setSectioning__SWIG_1(this.swigCPtr, OdGePoint3dArray.getCPtr(points), OdGeVector3d.getCPtr(upVector), dTop, dBottom);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setSectioningVisualStyle(OdDbStub visualStyleId)
		{
			GlobalsPINVOKE.OdGsModel_setSectioningVisualStyle(this.swigCPtr, OdDbStub.getCPtr(visualStyleId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum InvalidationHint
		{
			kInvalidateIsolines,
			kInvalidateViewportCache,
			kInvalidateAll,
			kInvalidateMaterials,
			kInvalidateLinetypes
		}

		public enum RenderType
		{
			kMain,
			kSprite,
			kDirect,
			kHighlight,
			kHighlightSelection,
			kDirectTopmost,
			kContrast,
			kUser1,
			kUser2,
			kUser3,
			kCount
		}

		public enum AdditionMode
		{
			kAddDrawable,
			kUneraseDrawable
		}
	}
}
